/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.org.auditoria.renta.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HP
 */
@Entity
@Table(name = "TIPOINGRESOS", catalog = "", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipoingresos.findAll", query = "SELECT t FROM Tipoingresos t"),
    @NamedQuery(name = "Tipoingresos.findByIdtipoingresos", query = "SELECT t FROM Tipoingresos t WHERE t.idtipoingresos = :idtipoingresos"),
    @NamedQuery(name = "Tipoingresos.findByNombretipoingresos", query = "SELECT t FROM Tipoingresos t WHERE t.nombretipoingresos = :nombretipoingresos")})
public class Tipoingresos implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDTIPOINGRESOS")
    private BigDecimal idtipoingresos;
    @Size(max = 25)
    @Column(name = "NOMBRETIPOINGRESOS")
    private String nombretipoingresos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoingresosIdtipoingresos")
    private List<Ingresos> ingresosList;

    public Tipoingresos() {
    }

    public Tipoingresos(BigDecimal idtipoingresos) {
        this.idtipoingresos = idtipoingresos;
    }

    public BigDecimal getIdtipoingresos() {
        return idtipoingresos;
    }

    public void setIdtipoingresos(BigDecimal idtipoingresos) {
        this.idtipoingresos = idtipoingresos;
    }

    public String getNombretipoingresos() {
        return nombretipoingresos;
    }

    public void setNombretipoingresos(String nombretipoingresos) {
        this.nombretipoingresos = nombretipoingresos;
    }

    @XmlTransient
    public List<Ingresos> getIngresosList() {
        return ingresosList;
    }

    public void setIngresosList(List<Ingresos> ingresosList) {
        this.ingresosList = ingresosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipoingresos != null ? idtipoingresos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoingresos)) {
            return false;
        }
        Tipoingresos other = (Tipoingresos) object;
        if ((this.idtipoingresos == null && other.idtipoingresos != null) || (this.idtipoingresos != null && !this.idtipoingresos.equals(other.idtipoingresos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.org.auditoria.renta.entity.Tipoingresos[ idtipoingresos=" + idtipoingresos + " ]";
    }
    
}
